package com.yatop.lalmbda.ai.model;

import com.yuyaogc.lowcode.engine.annotation.*;
import com.yuyaogc.lowcode.engine.context.Context;
import com.yuyaogc.lowcode.engine.plugin.activerecord.Model;

import java.sql.Timestamp;

@Table(displayName = "模型", name = "ai_model")
public class AiModel extends Model<AiModel> {

    @Id
    private Long id;

    @Column(label = "模型名")
    private String name;



    @Column(label = "大小")
    private String size;

    @Column(label = "用户id")
    private Long userId;

    @Column(label = "模型")
    private String model;

    @Column(label = "创建时间",name = "create_time")
    private Timestamp createTime;

    @Column(label = "更新时间", name = "update_time")
    private Timestamp updateTime;



    @Route
    public void create(AiModel value){
        value.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        value.setCreateTime(new Timestamp(System.currentTimeMillis()));
        value.setUserId(Context.getInstance().getUserId());
        value.save();
        System.out.println(1);
    }

    public Long getId() {
        return (Long) this.get("id");
    }

    public AiModel setId(Long id) {
        this.set("id", id);
        return this;
    }

    public String getName() {
        return (String) this.get("name");
    }

    public AiModel setName(String name) {
        this.set("name", name);
        return this;
    }

    public String getNegativePrompt() {
        return (String) this.get("negativePrompt");
    }

    public AiModel setNegativePrompt(String negativePrompt) {
        this.set("negativePrompt", negativePrompt);
        return this;
    }

    public String getSize() {
        return (String) this.get("size");
    }

    public AiModel setSize(String size) {
        this.set("size", size);
        return this;
    }

    public Long getUserId() {
        return (Long) this.get("userId");
    }

    public AiModel setUserId(Long userId) {
        this.set("userId", userId);
        return this;
    }

    public String getModel() {
        return (String) this.get("model");
    }

    public AiModel setModel(String model) {
        this.set("model", model);
        return this;
    }

    public Timestamp getCreateTime() {
        return (Timestamp) this.get("createTime");
    }

    public AiModel setCreateTime(Timestamp createTime) {
        this.set("createTime", createTime);
        return this;
    }

    public Timestamp getUpdateTime() {
        return (Timestamp) this.get("updateTime");
    }

    public AiModel setUpdateTime(Timestamp updateTime) {
        this.set("updateTime", updateTime);
        return this;
    }
}
